prepare-root: Rename rootfs loading functions
authorColin Walters <walters@verbum.org>
Wed, 16 Jul 2025 16:56:49 +0000 (12:56 -0400)
committerColin Walters <walters@verbum.org>
Wed, 16 Jul 2025 17:29:08 +0000 (13:29 -0400)
Prep for moving more functionality there, it's really about
the rootfs, not just composefs.

src/libostree/ostree-soft-reboot.c
src/libostree/ostree-sysroot-deploy.c
src/libotcore/otcore-prepare-root.c
src/libotcore/otcore.h
src/switchroot/ostree-prepare-root.c

index e44db255b0ccc3c441dfe933fb85693e8f5cbfb6..d4c6e3a41ae42acfdc61ab3fa66879336f04bfa3 100644 (file)
@@ -56,8 +56,8 @@ _ostree_prepare_soft_reboot (GError **error)
     return FALSE;
 
   g_autofree char *kernel_cmdline = read_proc_cmdline ();
-  g_autoptr (ComposefsConfig) composefs_config
-      = otcore_load_composefs_config (kernel_cmdline, config, TRUE, error);
+  g_autoptr (RootConfig) composefs_config
+      = otcore_load_rootfs_config (kernel_cmdline, config, TRUE, error);
   if (!composefs_config)
     return FALSE;
 
index 18be562099cb0947d8e8f0c2c9e9b8aaed367137..92176bd77a1922820a298048cc34e59fdf78c4e6 100644 (file)
@@ -656,8 +656,8 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, const char *
   // out if it's enabled, but not supported at compile time.
   // However, we don't load the keys here, because they may not exist, such
   // as in the initial deploy
-  g_autoptr (ComposefsConfig) composefs_config
-      = otcore_load_composefs_config ("", prepare_root_config, FALSE, error);
+  g_autoptr (RootConfig) composefs_config
+      = otcore_load_rootfs_config ("", prepare_root_config, FALSE, error);
   if (!composefs_config)
     return glnx_prefix_error (error, "Reading composefs config");
 
index 7328698af8c14f58d32e25d73b0b276d4a9f69dd..0a147a67d4483ac7037b5952eb952333e0292f0c 100644 (file)
@@ -165,24 +165,24 @@ otcore_load_config (int rootfs_fd, const char *filename, GError **error)
 }
 
 void
-otcore_free_composefs_config (ComposefsConfig *config)
+otcore_free_rootfs_config (RootConfig *config)
 {
   g_clear_pointer (&config->pubkeys, g_ptr_array_unref);
   g_free (config->signature_pubkey);
   g_free (config);
 }
 
-// Parse the [composefs] section of the prepare-root.conf.
-ComposefsConfig *
-otcore_load_composefs_config (const char *cmdline, GKeyFile *config, gboolean load_keys,
-                              GError **error)
+// Parse key bits of prepare-root.conf into a data structure.
+RootConfig *
+otcore_load_rootfs_config (const char *cmdline, GKeyFile *config, gboolean load_keys,
+                           GError **error)
 {
   g_assert (cmdline);
   g_assert (config);
 
-  GLNX_AUTO_PREFIX_ERROR ("Loading composefs config", error);
+  GLNX_AUTO_PREFIX_ERROR ("Parsing rootfs config", error);
 
-  g_autoptr (ComposefsConfig) ret = g_new0 (ComposefsConfig, 1);
+  g_autoptr (RootConfig) ret = g_new0 (RootConfig, 1);
 
   g_autofree char *enabled = g_key_file_get_value (config, OTCORE_PREPARE_ROOT_COMPOSEFS_KEY,
                                                    OTCORE_PREPARE_ROOT_ENABLED_KEY, NULL);
@@ -428,7 +428,7 @@ otcore_mount_etc (GKeyFile *config, GVariantBuilder *metadata_builder, const cha
 }
 
 gboolean
-otcore_mount_rootfs (ComposefsConfig *composefs_config, GVariantBuilder *metadata_builder,
+otcore_mount_rootfs (RootConfig *composefs_config, GVariantBuilder *metadata_builder,
                      gboolean root_transient, const char *root_mountpoint, const char *deploy_path,
                      const char *mount_target, bool *out_using_composefs, GError **error)
 {
index 19348be7a44c8a57c483ebba1b64bbb5ae810334..82dfae905f9289af4d2415c0bed81619b4831f2a 100644 (file)
@@ -71,12 +71,12 @@ typedef struct
   gboolean is_signed;
   char *signature_pubkey;
   GPtrArray *pubkeys;
-} ComposefsConfig;
-void otcore_free_composefs_config (ComposefsConfig *config);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (ComposefsConfig, otcore_free_composefs_config)
+} RootConfig;
+void otcore_free_rootfs_config (RootConfig *config);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (RootConfig, otcore_free_rootfs_config)
 
-ComposefsConfig *otcore_load_composefs_config (const char *cmdline, GKeyFile *config,
-                                               gboolean load_keys, GError **error);
+RootConfig *otcore_load_rootfs_config (const char *cmdline, GKeyFile *config, gboolean load_keys,
+                                       GError **error);
 
 /**
  * otcore_mount_rootfs:
@@ -94,7 +94,7 @@ ComposefsConfig *otcore_load_composefs_config (const char *cmdline, GKeyFile *co
  *
  * Returns: %TRUE on success, %FALSE on error.
  */
-gboolean otcore_mount_rootfs (ComposefsConfig *composefs_config, GVariantBuilder *metadata_builder,
+gboolean otcore_mount_rootfs (RootConfig *composefs_config, GVariantBuilder *metadata_builder,
                               gboolean root_transient, const char *root_mountpoint,
                               const char *deploy_path, const char *mount_target,
                               bool *out_using_composefs, GError **error);
index 8cdfbaa7947dba96921bce5f71fb470e08b4c1d2..7eeeb7f49da4c99914a34a5e7f75c2cd39904e43 100644 (file)
@@ -192,8 +192,8 @@ main (int argc, char *argv[])
 
   // We always parse the composefs config, because we want to detect and error
   // out if it's enabled, but not supported at compile time.
-  g_autoptr (ComposefsConfig) composefs_config
-      = otcore_load_composefs_config (kernel_cmdline, config, TRUE, &error);
+  g_autoptr (RootConfig) composefs_config
+      = otcore_load_rootfs_config (kernel_cmdline, config, TRUE, &error);
   if (!composefs_config)
     errx (EXIT_FAILURE, "%s", error->message);